<template>
  <!--新增/修改答辩组-->
  <div class="edu-page-warp reply-team">
    <el-card shadow="never">
      <p class="reply-title">{{$t('graduationDesign.replyGroupInfo')}}</p>
      <el-form :model="replyTeamForm" ref="replyTeamForm" :rules="replyTeamRules" label-position="right" label-suffix="：" label-width="140px" :disabled="actionType === 'VIEW'">
        <el-row>
          <!-- 毕业年份 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.graduationYear')" prop="graduationYear">
              <el-date-picker clearable v-model="replyTeamForm.graduationYear" @change="handleGradeChange" class="form-input" value-format="yyyy" type="year" :placeholder="$t('graduationDesign.pleaseChoose')">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <!-- 学院 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.college')" prop="collegeId">
              <el-select v-model="replyTeamForm.collegeId" filterable clearable @change="handleCollegeChange" class="form-input" clearable>
                <el-option v-for="item in insource.collegeOptions" :key="item.collegeId" :label="item.collegeIdI18n" :value="item.collegeId" />
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 答辩课题专业 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.replySubjectMajor')" prop="subjectId">
              <el-select v-model="replyTeamForm.subjectId" @change="handleSubjectChange" filterable clearable class="form-input" clearable>
                <el-option v-for="item in insource.subjectOptions" :key="item.subjectId" :label="item.subjectName" :value="item.subjectId" />
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 答辩组名称 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.replyGroupName')" prop="defenseGroupName">
              <el-input v-model="replyTeamForm.defenseGroupName" :placeholder="$t('graduationDesign.pleaseEnter')" maxlength="32" class="form-input"></el-input>
            </el-form-item>
          </el-col>
          <!-- 答辩地点 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.replyLocation')" prop="defenseLocation">
              <el-input v-model="replyTeamForm.defenseLocation" :placeholder="$t('graduationDesign.pleaseEnter')" maxlength="32" class="form-input"></el-input>
            </el-form-item>
          </el-col>
          <!-- 答辩开始时间 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.replyStartTime')" prop="defenseStartTime">
              <el-date-picker v-model="replyTeamForm.defenseStartTime" @change="handleDateChange" class="form-input" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" :placeholder="$t('graduationDesign.pleaseChoose')">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <!-- 答辩委员会成员 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.replyCommitteeMember')" class="reply-team-select" prop="allCommitteeMemberCodeList">
              <el-select v-model="replyTeamForm.allCommitteeMemberCodeList" multiple collapse-tags class="form-input" :placeholder="$t('graduationDesign.pleaseChoose')" v-if="actionType !=='VIEW' && canSelectCommittee" :disabled="!canSelectCommittee">
                <el-option v-for="item in source.committeeOptions" :key="item.teacherId || item.value" :label="item.teacherNameAndId || item.label" :value="item.teacherId || item.value">
                </el-option>
              </el-select>
              <el-button type="text" class="float-right reply-select-btn" @click="onSelect(selectType.teacher, columnType.COMMITTEE_MEMBER)" v-if="actionType !=='VIEW' && canSelectCommittee" :disabled="!canSelectCommittee">{{$t('graduationDesign.choose')}}</el-button>

              <el-input v-model="replyTeamForm.committeeMemberNames" :title="replyTeamForm.committeeMemberNames" class="form-input" disabled v-if="!canSelectCommittee"/>
            </el-form-item>
          </el-col>
          <!-- 答辩组长 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.replyGroupLeader')" class="reply-team-select" prop="allDefenseGroupLeader">
              <el-select v-model="replyTeamForm.allDefenseGroupLeader" class="form-input" :placeholder="$t('graduationDesign.pleaseChoose')">
                <el-option v-for="item in source.leaderOptions" :key="item.teacherId || item.value" :label="item.teacherNameAndId || item.label" :value="item.teacherId  || item.value">
                </el-option>
              </el-select>
              <el-button type="text" class="float-right reply-select-btn" @click="onSelect(selectType.teacher, columnType.DEFENSE_GROUP_LEADER)" v-if="actionType !=='VIEW'">{{$t('graduationDesign.choose')}}</el-button>
            </el-form-item>
          </el-col>
          <!-- 答辩组老师 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.replyGroupTeacher')" class="reply-team-select" prop="allTeacherCodeList">
              <el-select v-model="replyTeamForm.allTeacherCodeList" class="form-input" multiple collapse-tags :placeholder="$t('graduationDesign.pleaseChoose')" v-if="actionType !=='VIEW'">
                <el-option v-for="item in source.teacherOptions" :key="item.teacherId || item.value" :label="item.teacherNameAndId || item.label" :value="item.teacherId || item.value">
                </el-option>
              </el-select>
              <el-button type="text" class="float-right reply-select-btn" @click="onSelect(selectType.teacher, columnType.GROUP_TEACHER)" v-if="actionType !=='VIEW'">{{$t('graduationDesign.choose')}}</el-button>

              <el-input v-model="replyTeamForm.teacherNames" :title="replyTeamForm.teacherNames" class="form-input" disabled v-else></el-input>
            </el-form-item>
          </el-col>
          <!-- 答辩学生 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.replyStudent')" class="reply-team-select" prop="studentCodeList">
              <el-select v-model="replyTeamForm.studentCodeList" class="form-input" multiple collapse-tags :placeholder="$t('graduationDesign.pleaseChoose')" v-if="actionType !=='VIEW'">
                <el-option v-for="item in source.studentOptions" :key="item.studentId || item.value" :label="item.studentName || item.label" :value="item.studentId || item.value">
                </el-option>
              </el-select>
              <el-button type="text" class="float-right reply-select-btn" @click="onSelect(selectType.student, columnType.GROUP_STUDENT)" v-if="actionType !=='VIEW'">{{$t('graduationDesign.choose')}}</el-button>

              <el-input v-model="replyTeamForm.studentNames" :title="replyTeamForm.studentNames" class="form-input" disabled v-else></el-input>
            </el-form-item>
          </el-col>
          <!-- 外专业答辩学生 -->
          <el-col :span="12">
            <el-form-item :label="$t('graduationDesign.foreignReplyStudent')" class="reply-team-select">
              <el-select v-model="replyTeamForm.otherSubjectStudentCodeList" class="form-input" multiple collapse-tags :placeholder="$t('graduationDesign.pleaseChoose')" v-if="actionType !=='VIEW'">
                <el-option v-for="item in source.foreignStudentOptions" :key="item.studentId || item.value" :label="item.studentName || item.label" :value="item.studentId || item.value">
                </el-option>
              </el-select>
              <el-button type="text" class="float-right reply-select-btn" @click="onSelect(selectType.otherStudent, columnType.GROUP_OTHER_STUDENT)" v-if="actionType !=='VIEW'">{{$t('graduationDesign.choose')}}</el-button>

              <el-input v-model="replyTeamForm.foreignStudentNames" :title="replyTeamForm.foreignStudentNames" class="form-input" disabled v-else></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <!-- 操作按钮 -->
      <div class="edu-opertion-bar bottom-line" v-if="actionType === 'ADD' || actionType === 'EDIT'">
        <div class="float-right bottom-btn">
          <el-button @click="onCancel">{{$t('graduationDesign.cancel')}}</el-button>
          <el-button type="primary" @click="onSubmit">{{$t('graduationDesign.submit')}}</el-button>
        </div>
      </div>
    </el-card>
  </div>
</template>
<script>
import API from "common/src/api/underGraduationDesign/assignReplyStudent";

export default {
  name: 'replyTeam',
  props: {
    replyTeamForm: {
      type: Object,
      default: {
        graduationYear: '',
        collegeId: '',
        subjectId: '',
        defenseGroupName: '',
        defenseLocation: '',
        defenseStartTime: '',
        allCommitteeMemberCodeList: [],
        committeeMemberCodeList: [],
        committeeMemberCodeOuterList: [],
        defenseGroupLeader: '',
        defenseGroupLeaderOuter: '',
        allDefenseGroupLeader: '',
        teacherCodeList: [],
        teacherCodeOuterList: [],
        allTeacherCodeList: [],
        studentCodeList: [],
        otherSubjectStudentCodeList: []
      }
    },
    actionType: {
      type: String,
      default: 'ADD'
    },
    source: {
      type: Object,
      default: {
        committeeOptions: [], // 答辩委员会
        leaderOptions: [], // 答辩组长
        teacherOptions: [], // 老师
        studentOptions: [], // 学生
        foreignStudentOptions: [] // 外专业学生
      }
    },
    canSelectCommittee: true
  },
  data() {
    return {
      api: API,
      replyTeamRules: {
        graduationYear: [
          { required: true, message: this.$t('graduationDesign.pleaseChoose'), trigger: 'change' }
        ],
        collegeId: [
          { required: true, message: this.$t('graduationDesign.pleaseChoose'), trigger: 'change' }
        ],
        defenseGroupName: [
          { required: true, message: this.$t('graduationDesign.pleaseEnter'), trigger: 'blur' }
        ],
        defenseLocation: [
          { required: true, message: this.$t('graduationDesign.pleaseEnter'), trigger: 'blur' }
        ],
        defenseStartTime: [
          { required: true, message: this.$t('graduationDesign.pleaseChoose'), trigger: 'change' }
        ],
        subjectId: [
          { required: true, message: this.$t('graduationDesign.pleaseChoose'), trigger: 'change' }
        ],
        allCommitteeMemberCodeList: [
          { required: true, message: this.$t('graduationDesign.pleaseChoose'), trigger: 'change' }
        ],
        allDefenseGroupLeader: [
          { required: true, message: this.$t('graduationDesign.pleaseChoose'), trigger: 'change' }
        ],
        allTeacherCodeList: [
          { required: true, message: this.$t('graduationDesign.pleaseChoose'), trigger: 'change' }
        ],
        studentCodeList: [
          { required: true, message: this.$t('graduationDesign.pleaseChoose'), trigger: 'change' }
        ]
      },
      insource: {
        collegeOptions: [],
        subjectOptions: [],
      },
      currentOldGraduationYear: "",
      currentOldCollegeId: "",
      currentOldSubjectId: "",
      currentOldStartTime: "",
      selectType: {
        teacher: 1,
        student: 2,
        otherStudent: 3
      },
      columnType: {
        DEFENSE_GROUP_LEADER: 'allDefenseGroupLeader',
        COMMITTEE_MEMBER: 'allCommitteeMemberCodeList',
        GROUP_TEACHER: 'allTeacherCodeList',
        GROUP_STUDENT: 'studentCodeList',
        GROUP_OTHER_STUDENT: 'otherSubjectStudentCodeList'
      },
      teacherType: {
        allDefenseGroupLeader: {
          inner: 'defenseGroupLeader',
          outer: 'defenseGroupLeaderOuter',
          innerList: 'defenseGroupLeaderList',
          outerList: 'defenseGroupLeaderOutList'
        },
        allCommitteeMemberCodeList: {
          inner: 'committeeMemberCodeList',
          outer: 'committeeMemberCodeOuterList',
          innerList: 'defenseCommitteeMemberList',
          outerList: 'defenseCommitteeMemberOutList'
        },
        allTeacherCodeList: {
          inner: 'teacherCodeList',
          outer: 'teacherCodeOuterList',
          innerList: 'defenseGroupTeacherList',
          outerList: 'defenseGroupTeacherOutList'
        }
      }
    };
  },
  watch: {
    "replyTeamForm.graduationYear": {
      handler: function (val, oldVal) {
        this.currentOldGraduationYear = oldVal;
      },
      deep: true
    },
    "replyTeamForm.collegeId": {
      handler: function (val, oldVal) {
        this.currentOldCollegeId = oldVal;
      },
      deep: true
    },
    "replyTeamForm.subjectId": {
      handler: function (val, oldVal) {
        this.currentOldSubjectId = oldVal;
      },
      deep: true
    },
    "replyTeamForm.defenseStartTime": {
      handler: function (val, oldVal) {
        this.currentOldStartTime = oldVal;
      },
      deep: true
    }
  },
  mounted() {
    this.getCollege();
    this.$nextTick(() => {
      this.$refs.replyTeamForm.clearValidate();
    });
    if (this.replyTeamForm.graduationYear && this.replyTeamForm.collegeId) {
      const params = {
        grade: this.replyTeamForm.graduationYear,
        college: this.replyTeamForm.collegeId
      };
      this.getSubjectData(params);
    }
  },
  methods: {
    // 查学院
    getCollege() {
      this.api.getCollege().then(res => {
        this.insource.collegeOptions = res;
      });
    },
    // 查专业
    getSubjectData(params) {
      this.api.getSubject(params).then(res => {
        this.insource.subjectOptions = res.data;
        this.$nextTick(function () {
          this.$refs.replyTeamForm.clearValidate();
        });
      }).catch();
    },
    handleGradeChange(val) {
      const params = {
        grade: val,
        college: this.replyTeamForm.subjectId
      };
      // 专业有值且存在已选学生时
      if (this.replyTeamForm.subjectId && (this.source.studentOptions.length || this.source.foreignStudentOptions.length)) {
        this.$eduConfirm(this.$t('graduationDesign.replyGradeChangeTips'), this.$t('graduationDesign.prompt')).then(() => {
          this.replyTeamForm.studentCodeList = [];
          this.replyTeamForm.otherSubjectStudentCodeList = [];
          this.source.studentOptions = [];
          this.source.foreignStudentOptions = [];
          // 清空专业
          this.replyTeamForm.subjectId = "";
          this.insource.subjectOptions = [];
          this.$nextTick(function () {
            this.$refs.replyTeamForm.clearValidate();
          });
          // 毕业年份和学院不为空则查专业
          if (val && this.replyTeamForm.collegeId) {
            this.getSubjectData(params);
          }
        }).catch(() => {
          this.replyTeamForm.graduationYear = this.currentOldGraduationYear;
        });
      } else {
        this.replyTeamForm.subjectId = "";
        this.insource.subjectOptions = [];
        this.$nextTick(function () {
          this.$refs.replyTeamForm.clearValidate();
        });
        // 毕业年份和学院不为空则查专业
        if (val && this.replyTeamForm.collegeId) {
          this.getSubjectData(params);
        }
      }
    },
    // 选择学院查专业
    handleCollegeChange(val) {
      if (!this.replyTeamForm.graduationYear) {
        this.$eduAlert(this.$t('graduationDesign.pleaseChooseGraduationYear'), this.$t('graduationDesign.prompt'));
        return;
      }
      const params = {
        grade: this.replyTeamForm.graduationYear,
        college: val
      };
      // 专业有值且存在已选学生时
      if (this.replyTeamForm.subjectId && (this.source.studentOptions.length || this.source.foreignStudentOptions.length)) {
        this.$eduConfirm(this.$t('graduationDesign.replyCollegeChangeTips'), this.$t('graduationDesign.prompt')).then(() => {
          this.replyTeamForm.studentCodeList = [];
          this.replyTeamForm.otherSubjectStudentCodeList = [];
          this.source.studentOptions = [];
          this.source.foreignStudentOptions = [];
          // 清空专业
          this.replyTeamForm.subjectId = "";
          this.insource.subjectOptions = [];
          this.$nextTick(function () {
            this.$refs.replyTeamForm.clearValidate();
          });
          // 学院不为空则查专业
          if (val) {
            this.getSubjectData(params);
          }
        }).catch(() => {
          this.replyTeamForm.collegeId = this.currentOldCollegeId;
        });
      } else {
        this.replyTeamForm.subjectId = "";
        this.insource.subjectOptions = [];
        this.$nextTick(function () {
          this.$refs.replyTeamForm.clearValidate();
        });
        // 学院不为空则查专业
        if (val) {
          this.getSubjectData(params);
        }
        if (this.actionType === 'ADD') {
          this.getDefenseGroupCommitteeMember(this.replyTeamForm.graduationYear, val);
        }
      }
    },
    // 根据毕业年份和查询已保存的答辩委员会成员
    getDefenseGroupCommitteeMember(grade, collegeId) {
      this.api.getDefenseGroupCommitteeMember(grade, collegeId).then(res => {
        const innerTeachers = res.data.innerTeachers;
        const outerTeachers = res.data.outerTeachers;
        if (!innerTeachers && !outerTeachers) {
          this.canSelectCommittee = true;
          this.replyTeamForm["defenseCommitteeMembers"] = '';
          this.replyTeamForm["defenseCommitteeMembersOuter"] = '';
          this.replyTeamForm["committeeMemberCodeList"] = [];
          this.replyTeamForm["committeeMemberCodeOuterList"] = [];
          this.replyTeamForm["defenseCommitteeMemberList"] = [];
          this.replyTeamForm["defenseCommitteeMemberOutList"] = [];
          this.replyTeamForm["allCommitteeMemberCodeList"] = [];
          this.source["committeeOptions"] = [];
          this.replyTeamForm.committeeMemberNames = '';
          return;
        }
        const innerTeacherIds = (innerTeachers || []).map(item => item.teacherId);
        const outerTeacherIds = (outerTeachers || []).map(item => item.teacherId);
        this.replyTeamForm["defenseCommitteeMembers"] = innerTeacherIds.join(',');
        this.replyTeamForm["defenseCommitteeMembersOuter"] = outerTeacherIds.join(',');
        this.replyTeamForm["committeeMemberCodeList"] = innerTeacherIds;
        this.replyTeamForm["committeeMemberCodeOuterList"] = outerTeacherIds;
        this.replyTeamForm["defenseCommitteeMemberList"] = innerTeachers;
        this.replyTeamForm["defenseCommitteeMemberOutList"] = outerTeachers;
        this.replyTeamForm["allCommitteeMemberCodeList"] = [...new Set(innerTeacherIds.concat(outerTeacherIds))];
        const options = this.mergeTeachers(innerTeachers, outerTeachers);
        this.source["committeeOptions"] = options;
        this.replyTeamForm.committeeMemberNames = options.map(item => item.teacherNameAndId).join("、");
        this.canSelectCommittee = false;
      });
    },
    // 课题专业修改，清空学生选项
    handleSubjectChange(val) {
      if (this.source.studentOptions.length || this.source.foreignStudentOptions.length) {
        this.$eduConfirm(this.$t('graduationDesign.replyMajorChangeTips'), this.$t('graduationDesign.prompt')).then(() => {
          this.replyTeamForm.studentCodeList = [];
          this.replyTeamForm.otherSubjectStudentCodeList = [];
          this.source.studentOptions = [];
          this.source.foreignStudentOptions = [];
          this.$nextTick(function () {
            this.$refs.replyTeamForm.clearValidate();
          });
        }).catch(() => {
          this.replyTeamForm.subjectId = this.currentOldSubjectId;
        });
      }
    },
    // 答辩开始时间修改，清空老师选项
    handleDateChange(val) {
      if (this.source.committeeOptions.length || this.source.leaderOptions.length || this.source.teacherOptions.length) {
        this.$eduConfirm(this.$t('graduationDesign.replyStartTimeChangeTips'), this.$t('graduationDesign.prompt')).then(() => {
          this.replyTeamForm.committeeMemberCodeList = [];
          this.replyTeamForm.defenseGroupLeader = "";
          this.replyTeamForm.teacherCodeList = [];
          this.source.committeeOptions = [];
          this.source.leaderOptions = [];
          this.source.teacherOptions = [];
          this.$nextTick(function () {
            this.$refs.replyTeamForm.clearValidate();
          });
        }).catch(() => {
          this.replyTeamForm.defenseStartTime = this.currentOldStartTime;
        });
      }
    },
    // 选择老师、学生(答辩委员会成员，答辩组组长，答辩组老师，答辩学生，外专业答辩学生)
    onSelect(selectType, columnType) {
      const isTeacher = selectType === this.selectType.teacher;
      const params = {
        selectType,
        isTeacher,
        columnType,
        actionType: this.actionType,
        replyTeamForm: this.replyTeamForm,
        // 导师学生列表，数据源的字段别名props
        value: isTeacher ? 'teacherId' : 'studentId',
        label: isTeacher ? 'teacherNameAndId' : 'studentName'
      };
      this.getAllStudentOrTeacherInfo(selectType).then(response => {
        const data = response.data;
        if (isTeacher) {
          params.stuTeacherData = this.mergeTeachers(data.innerTeachers, this.replyTeamForm[this.teacherType[columnType].innerList]);
          params.stuTeacherOuterData = this.mergeTeachers(data.outerTeachers, this.replyTeamForm[this.teacherType[columnType].outerList]);
          params.rightCheckedList = this.replyTeamForm[this.teacherType[columnType].inner];
          params.rightCheckedOuterList = this.replyTeamForm[this.teacherType[columnType].outer];
        } else {
          params.stuTeacherData = data;
          params.rightCheckedList = this.replyTeamForm[columnType];
        }
        if (columnType === this.columnType.DEFENSE_GROUP_LEADER) {
          params.rightCheckedList = this.replyTeamForm.defenseGroupLeader ? [this.replyTeamForm.defenseGroupLeader] : [];
          params.rightCheckedOuterList = this.replyTeamForm.defenseGroupLeaderOuter ? [this.replyTeamForm.defenseGroupLeaderOuter] : [];;
        }
        this.$emit("select-teacher-stu", params);
      });
    },
    // 合并老师数据并去重
    mergeTeachers(part1Teachers, part2Teachers) {
      const result = [...(part1Teachers || [])];
      (part2Teachers || []).forEach(item => {
        if (!part1Teachers.some(teacher => teacher.teacherId === item.teacherId)) {
          result.push(item);
        }
      });
      return result;
    },
    // 获取当前选中的学院名称
    getCurrentSelectCollegeName () {
      const selectedCollege = this.insource.collegeOptions.filter(item => item.collegeId === this.replyTeamForm.collegeId);
      if (selectedCollege && selectedCollege.length) {
        return selectedCollege[0].collegeIdI18n
      }
      return '';
    },
    // 获取请求老师或学生的统一请求参数
    getParams4RequestStuOrTeaInfo () {
      return {
        id: this.replyTeamForm.id,
        collegeId: this.replyTeamForm.collegeId,
        graduationYear: this.replyTeamForm.graduationYear,
        defenseStartTime: this.replyTeamForm.defenseStartTime,
        // 学院名称，用于查询校外导师
        collegeName: this.getCurrentSelectCollegeName(),
        // 专业id，用户查询学生信息
        subjectId: this.replyTeamForm.subjectId
      };
    },
    // 获取可选择的校内外教师列表数据
    getAllTeacherInfo() {
      return this.api.getTeacher(this.getParams4RequestStuOrTeaInfo());
    },
    // 获取可选择的本专业的答辩学生列表数据
    getAllStudentInfo() {
      return this.api.getStudent(this.getParams4RequestStuOrTeaInfo());
    },
    // 获取可选择的外专业的答辩学生列表数据
    getAllOtherStudentInfo() {
      return this.api.getForeignStudent(this.getParams4RequestStuOrTeaInfo());
    },
    getAllStudentOrTeacherInfo (selectType) {
      let request;
      switch (selectType) {
        case this.selectType.teacher:
          request = this.getAllTeacherInfo();
          break;
        case this.selectType.student:
          request = this.getAllStudentInfo();
          break;
        default:
          request = this.getAllOtherStudentInfo();
      }
      return request;
    },
    // 校验表单
    validateForm() {
      const form = this.replyTeamForm;
      // 答辩委员会成员，不能少于5个
      if (form.allCommitteeMemberCodeList.length < 5) {
        this.$eduAlert(this.$t('graduationDesign.replyCommitteeMemberValidateMsg'));
        return false;
      }
      // 答辩组组长，至多选择一个
      if (form.allDefenseGroupLeader.split(",").length > 1) {
        this.$eduAlert("只能选择一个答辩组组长");
        return false;
      }
      // 答辩组老师，不能少于3个
      if (form.allTeacherCodeList.length < 2) {
        this.$eduAlert(this.$t('graduationDesign.replyCommitteeMemberValidateMsg'));
        return false;
      }
      return true;
    },
    // 新增，修改答辩组提交
    onSubmit() {
      this.$refs.replyTeamForm.validate(valid => {
        if (valid) {
          if (!this.validateForm()) {
            return false;
          }
          this.$eduConfirm('答辩委员会成员修改时会一并修改同毕业年份同学院下的其他答辩组的委员会成员，请知', '提示').then(() => {
            this.$emit("reply-submit", this.replyTeamForm, this.actionType);
          });
        } else {
          return false;
        }
      });
    },
    onCancel() {
      this.$emit("reply-cancel");
    }
  }
}
</script>
<style lang="scss" scoped>
.reply-team {
    .reply-title {
        font-weight: normal;
        font-size: 16px;
        margin-left: 30px;
    }
    .form-input {
        width: 100%;
    }
    .bottom-line {
        border-top: 1px solid #dcdfe6;
        .bottom-btn {
            margin-top: 20px;
        }
    }
    .reply-team-select {
        ::v-deep .el-input__suffix {
            display: none;
        }
    }
    .reply-select-btn {
        position: absolute;
        right: 10px;
        top: 0px;
    }
}
</style>
